﻿using System.Windows.Input;
using System;
using Autodesk.Windows;
using Autodesk.AutoCAD.ApplicationServices;

namespace Galaxy.AutoCAD.Ribbons
{
    public class CommandHandlerTool:ICommand
    {
        public bool CanExecute(object parameter)
        {
            return true;
        }
        public event EventHandler CanExecuteChanged;
        public void Execute(object parameter)
        {
            RibbonButton rb = parameter as RibbonButton;
            if (rb == null || rb.CommandParameter == null)
            {
                return;
            }
            Document doc = Application.DocumentManager.MdiActiveDocument;
            doc.SendStringToExecute(rb.CommandParameter.ToString(), true, false, true);
        }
    }
}
